<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

<script>
// This test checks createLinearGradient with infinite values
var ctx = document.createElement('canvas').getContext('2d');

function testCreateLinearGradient(params)
{
    x0 = params[0]; y0 = params[1]; x1 = params[2]; y1 = params[3];
    assert_throws_js(TypeError, function() {
      ctx.createLinearGradient(x0, y0, x1, y1);
    });
}

var testScenarios = [
    ['Test createLinearGradient(0, 0, 100, NaN)' , [0, 0, 100, NaN]],
    ['Test createLinearGradient(0, 0, 100, Infinity)' , [0, 0, 100, Infinity]],
    ['Test createLinearGradient(0, 0, 100, -Infinity)' , [0, 0, 100, -Infinity]],
    ['Test createLinearGradient(0, 0, NaN, 100)' , [0, 0, NaN, 100]],
    ['Test createLinearGradient(0, 0, Infinity, 100)' , [0, 0, Infinity, 100]],
    ['Test createLinearGradient(0, 0, -Infinity, 100)' , [0, 0, -Infinity, 100]],
    ['Test createLinearGradient(0, NaN, 100, 100)' , [0, NaN, 100, 100]],
    ['Test createLinearGradient(0, Infinity, 100, 100)' , [0, Infinity, 100, 100]],
    ['Test createLinearGradient(0, -Infinity, 100, 100)' , [0, -Infinity, 100, 100]],
    ['Test createLinearGradient(NaN, 0, 100, 100)' , [NaN, 0, 100, 100]],
    ['Test createLinearGradient(Infinity, 0, 100, 100)' , [Infinity, 0, 100, 100]],
    ['Test createLinearGradient(-Infinity, 0, 100, 100)' , [-Infinity, 0, 100, 100]],
];

generate_tests(testCreateLinearGradient, testScenarios);
</script>
